﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _5_控件2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)//判断是否上传文件
        {
            //Server.MapPath,VirtualPathUtility.ToAbsolute都可以
            string uploadPath = Server.MapPath("~/upload/");
            FileUpload1.SaveAs(uploadPath + FileUpload1.FileName);//上传文件的文件名
        }
    }
}